home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / HardwareProjects / i2clib38.lha / Glue / SAS-C / src / AutoOpen_I2C.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-28  |  564 b   |  30 lines

  1. void __regargs  __autoopenfail (char *);
  2.  
  3. #include <proto/exec.h>
  4. #include <utility/tagitem.h>
  5.  
  6. struct Library *I2C_Base;
  7. static void *libbase;
  8. extern long __oslibversion;
  9.  
  10. void __stdargs _STI_openi2c (void)
  11. {
  12.     long old_os_lib = __oslibversion;
  13.  
  14.     __oslibversion = 38L;
  15.  
  16.     I2C_Base = libbase = (void *) OpenLibrary ("i2c.library", __oslibversion);
  17.     if (!I2C_Base)
  18.         __autoopenfail ("i2c.library");
  19.  
  20.     __oslibversion = old_os_lib;
  21. }
  22.  
  23. void __stdargs _STD_closei2c (void)
  24. {
  25.     if (libbase) {
  26.         CloseLibrary ((struct Library *) libbase);
  27.         libbase = I2C_Base = NULL;
  28.         }
  29. }
  30.